package tuanvn.iti.vn;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

import mrtran.iti.vn.Main;
import mrtran.iti.vn.Main.GameView;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;

public class SpriteKimCuong {
	private GameView gameView;
	private Bitmap bmp;
	private int  width,height;
	public static int  yKimCuong=(int) (Main.SCREENHEIGHT/1.8);
	public static int xKimCuong;	
	public static int widthLuffyKimCuong,KimCuongWidth;	
	public static int xKimCuongCenter,yKimCuongCenter;	
	public static int distanceKimCuong;
	private List<SpriteKimCuong> spriteKimCuong;
		
	public SpriteKimCuong(GameView gameView2, Bitmap bmp,List<SpriteKimCuong> spriteKimCuong,float xKimCuong2, float yKimCuong2) {
		this.gameView = gameView2;
		this.bmp = bmp;
		this.height=bmp.getHeight();
		this.width=bmp.getWidth();	
		this.xKimCuong=xKimCuong;
		this.yKimCuong=yKimCuong;
		Random rnd = new Random();
		xKimCuong = rnd.nextInt(gameView.getWidth()-width);
		this.spriteKimCuong = spriteKimCuong;
	}

	private void update() {
		if (distanceKimCuong < widthLuffyKimCuong) {
			Main.jewel = Main.jewel + 1;
			spriteKimCuong.remove(this);
			}	

		xKimCuongCenter = (int) (xKimCuong+width/2);
		yKimCuongCenter = (int) (yKimCuong+height/2);
		KimCuongWidth= width/2;
	}

	public void onDraw(Canvas canvas) {
		update();
		canvas.drawBitmap(bmp, xKimCuong, yKimCuong, null);
	}
}
